﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Media3D;
using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace STX.WPF.Controls
{
    public class XListView:ListView
    {
        protected override void
        PrepareContainerForItemOverride(DependencyObject element,
        object item)
        {
            base.PrepareContainerForItemOverride(element, item);
            if (View is GridView)
            {
                int index = ItemContainerGenerator.IndexFromContainer(element);
                ListViewItem lvi = element as ListViewItem;
                lvi.Height = 23;
                if (index % 2 == 0)
                {
                    lvi.Background = Brushes.White;
                }
                else
                {
                    lvi.Background = Brushes.Beige;
                }
            }
        }
    }
}
